/**
 * Matrix Framework Keycloak Theme - Main Login Styles
 * Matrix Framework企业级登录页面主样式文件
 */

/* ===== 全局变量定义 ===== */
:root {
    /* Matrix Framework 品牌色彩 */
    --matrix-primary-color: #667eea;
    --matrix-primary-dark: #5a6fd8;
    --matrix-primary-light: #7b8ff0;
    --matrix-secondary-color: #764ba2;
    --matrix-accent-color: #f093fb;

    /* 中性色彩 */
    --matrix-white: #ffffff;
    --matrix-gray-50: #f8f9fa;
    --matrix-gray-100: #e9ecef;
    --matrix-gray-200: #dee2e6;
    --matrix-gray-300: #ced4da;
    --matrix-gray-400: #adb5bd;
    --matrix-gray-500: #6c757d;
    --matrix-gray-600: #495057;
    --matrix-gray-700: #343a40;
    --matrix-gray-800: #212529;
    --matrix-gray-900: #1a1a2e;

    /* 状态色彩 */
    --matrix-success: #28a745;
    --matrix-warning: #ffc107;
    --matrix-error: #dc3545;
    --matrix-info: #17a2b8;

    /* 阴影 */
    --matrix-shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --matrix-shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --matrix-shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    --matrix-shadow-xl: 0 20px 40px rgba(0,0,0,0.2);

    /* 边框圆角 */
    --matrix-border-radius-sm: 6px;
    --matrix-border-radius: 12px;
    --matrix-border-radius-lg: 16px;
    --matrix-border-radius-xl: 24px;

    /* 字体 */
    --matrix-font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --matrix-font-size-xs: 0.75rem;    /* 12px */
    --matrix-font-size-sm: 0.875rem;   /* 14px */
    --matrix-font-size-base: 1rem;     /* 16px */
    --matrix-font-size-lg: 1.125rem;   /* 18px */
    --matrix-font-size-xl: 1.25rem;    /* 20px */
    --matrix-font-size-2xl: 1.5rem;    /* 24px */
    --matrix-font-size-3xl: 2rem;      /* 32px */
    --matrix-font-size-4xl: 2.5rem;    /* 40px */

    /* 间距 */
    --matrix-spacing-xs: 0.25rem;   /* 4px */
    --matrix-spacing-sm: 0.5rem;    /* 8px */
    --matrix-spacing: 1rem;         /* 16px */
    --matrix-spacing-lg: 1.5rem;    /* 24px */
    --matrix-spacing-xl: 2rem;      /* 32px */
    --matrix-spacing-2xl: 3rem;     /* 48px */
    --matrix-spacing-3xl: 4rem;     /* 64px */

    /* 过渡动画 */
    --matrix-transition-fast: all 0.15s ease;
    --matrix-transition: all 0.3s ease;
    --matrix-transition-slow: all 0.5s ease;
}

/* ===== 基础重置 ===== */
* {
    box-sizing: border-box;
}

.matrix-login-body {
    margin: 0;
    padding: 0;
    font-family: var(--matrix-font-family);
    background: linear-gradient(135deg, var(--matrix-primary-color) 0%, var(--matrix-secondary-color) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 主容器布局 ===== */
.matrix-login-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ===== 左侧品牌区域 ===== */
.matrix-brand-section {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--matrix-spacing-3xl);
    position: relative;
    z-index: 2;
}

.matrix-brand-content {
    max-width: 500px;
    text-align: center;
    color: var(--matrix-white);
}

/* Logo区域 */
.matrix-logo {
    margin-bottom: var(--matrix-spacing-2xl);
    animation: fadeInDown 0.8s ease;
}

.matrix-logo img {
    width: 120px;
    height: 120px;
    border-radius: var(--matrix-border-radius-xl);
    box-shadow: var(--matrix-shadow-xl);
    margin-bottom: var(--matrix-spacing);
    transition: var(--matrix-transition);
}

.matrix-logo img:hover {
    transform: scale(1.05) rotate(3deg);
}

.matrix-title {
    font-size: var(--matrix-font-size-4xl);
    font-weight: 300;
    margin: var(--matrix-spacing) 0;
    letter-spacing: -0.02em;
    background: linear-gradient(45deg, var(--matrix-white), rgba(255,255,255,0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.matrix-subtitle {
    font-size: var(--matrix-font-size-lg);
    opacity: 0.9;
    margin: 0;
    font-weight: 300;
}

/* 特性展示区域 */
.matrix-features {
    margin-top: var(--matrix-spacing-3xl);
    display: flex;
    flex-direction: column;
    gap: var(--matrix-spacing-xl);
}

.matrix-feature {
    display: flex;
    align-items: center;
    gap: var(--matrix-spacing);
    text-align: left;
    animation: fadeInLeft 0.8s ease;
    animation-fill-mode: both;
}

.matrix-feature:nth-child(1) { animation-delay: 0.2s; }
.matrix-feature:nth-child(2) { animation-delay: 0.4s; }
.matrix-feature:nth-child(3) { animation-delay: 0.6s; }

.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--matrix-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--matrix-font-size-xl);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.feature-text h4 {
    font-size: var(--matrix-font-size-lg);
    font-weight: 600;
    margin: 0 0 var(--matrix-spacing-xs) 0;
    color: var(--matrix-white);
}

.feature-text p {
    font-size: var(--matrix-font-size-sm);
    margin: 0;
    opacity: 0.8;
    color: var(--matrix-white);
}

/* ===== 右侧登录区域 ===== */
.matrix-login-section {
    flex: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--matrix-spacing-2xl);
    background: var(--matrix-white);
    position: relative;
    z-index: 2;
    box-shadow: -20px 0 60px rgba(0,0,0,0.1);
}

.matrix-login-card {
    width: 100%;
    max-width: 420px;
    position: relative;
}

/* 租户信息显示 */
.matrix-tenant-info {
    margin-bottom: var(--matrix-spacing-xl);
    text-align: center;
}

.tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--matrix-spacing-sm);
    background: var(--matrix-gray-50);
    padding: var(--matrix-spacing-sm) var(--matrix-spacing);
    border-radius: var(--matrix-border-radius-sm);
    border: 1px solid var(--matrix-gray-200);
    font-size: var(--matrix-font-size-sm);
    color: var(--matrix-gray-600);
}

.tenant-badge i {
    color: var(--matrix-primary-color);
}

/* ===== 登录头部 ===== */
.matrix-login-header {
    text-align: center;
    margin-bottom: var(--matrix-spacing-2xl);
}

.login-title {
    font-size: var(--matrix-font-size-3xl);
    font-weight: 700;
    color: var(--matrix-gray-800);
    margin: 0 0 var(--matrix-spacing-sm) 0;
}

.login-subtitle {
    font-size: var(--matrix-font-size-base);
    color: var(--matrix-gray-500);
    margin: 0;
}

/* ===== 表单样式 ===== */
.matrix-login-form {
    margin-bottom: var(--matrix-spacing-xl);
}

.matrix-form-group {
    margin-bottom: var(--matrix-spacing);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--matrix-spacing-sm);
    font-size: var(--matrix-font-size-sm);
    font-weight: 600;
    color: var(--matrix-gray-700);
    margin-bottom: var(--matrix-spacing-sm);
}

.form-label i {
    color: var(--matrix-primary-color);
    width: 16px;
    text-align: center;
}

.form-control {
    width: 100%;
    padding: var(--matrix-spacing) var(--matrix-spacing-lg);
    border: 2px solid var(--matrix-gray-200);
    border-radius: var(--matrix-border-radius);
    font-size: var(--matrix-font-size-base);
    transition: var(--matrix-transition);
    background: var(--matrix-white);
    color: var(--matrix-gray-700);
}

.form-control:focus {
    outline: none;
    border-color: var(--matrix-primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: var(--matrix-gray-400);
}

/* 密码输入容器 */
.password-input-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--matrix-spacing);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--matrix-gray-400);
    cursor: pointer;
    padding: var(--matrix-spacing-xs);
    border-radius: var(--matrix-border-radius-sm);
    transition: var(--matrix-transition);
}

.password-toggle:hover {
    color: var(--matrix-primary-color);
    background: var(--matrix-gray-50);
}

/* 记住登录选项 */
.matrix-form-check {
    display: flex;
    align-items: center;
    margin-bottom: var(--matrix-spacing-lg);
}

.form-check-input {
    width: 16px;
    height: 16px;
    margin-right: var(--matrix-spacing-sm);
    accent-color: var(--matrix-primary-color);
}

.form-check-label {
    font-size: var(--matrix-font-size-sm);
    color: var(--matrix-gray-600);
    cursor: pointer;
}

/* ===== 按钮样式 ===== */
.matrix-form-actions {
    margin-top: var(--matrix-spacing-xl);
}

.matrix-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--matrix-spacing-sm);
    padding: var(--matrix-spacing-lg) var(--matrix-spacing-xl);
    border: none;
    border-radius: var(--matrix-border-radius);
    font-size: var(--matrix-font-size-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--matrix-transition);
    position: relative;
    overflow: hidden;
}

.matrix-btn-primary {
    background: linear-gradient(135deg, var(--matrix-primary-color), var(--matrix-primary-dark));
    color: var(--matrix-white);
    box-shadow: var(--matrix-shadow-md);
}

.matrix-btn-primary:hover {
    background: linear-gradient(135deg, var(--matrix-primary-dark), var(--matrix-primary-color));
    transform: translateY(-2px);
    box-shadow: var(--matrix-shadow-lg);
}

.matrix-btn-primary:active {
    transform: translateY(0);
}

.matrix-btn-block {
    width: 100%;
}

/* ===== 分割线 ===== */
.matrix-divider {
    display: flex;
    align-items: center;
    margin: var(--matrix-spacing-xl) 0;
    color: var(--matrix-gray-400);
    font-size: var(--matrix-font-size-sm);
}

.matrix-divider::before,
.matrix-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--matrix-gray-200);
}

.matrix-divider span {
    padding: 0 var(--matrix-spacing);
}

/* ===== 社交登录 ===== */
.matrix-social-login {
    margin-top: var(--matrix-spacing-xl);
}

.social-login-grid {
    display: flex;
    flex-direction: column;
    gap: var(--matrix-spacing);
}

.social-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--matrix-spacing);
    padding: var(--matrix-spacing);
    border: 1px solid var(--matrix-gray-200);
    border-radius: var(--matrix-border-radius);
    text-decoration: none;
    font-size: var(--matrix-font-size-sm);
    font-weight: 500;
    color: var(--matrix-gray-700);
    background: var(--matrix-white);
    transition: var(--matrix-transition);
}

.social-login-btn:hover {
    background: var(--matrix-gray-50);
    border-color: var(--matrix-gray-300);
    transform: translateY(-1px);
}

.social-btn-wechat {
    color: #07c160;
    border-color: #07c160;
}

.social-btn-wechat:hover {
    background: rgba(7, 193, 96, 0.1);
}

.social-btn-dingtalk {
    color: #2e8de5;
    border-color: #2e8de5;
}

.social-btn-dingtalk:hover {
    background: rgba(46, 141, 229, 0.1);
}

/* ===== 警告消息 ===== */
.matrix-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--matrix-spacing);
    padding: var(--matrix-spacing);
    border-radius: var(--matrix-border-radius);
    margin-bottom: var(--matrix-spacing-xl);
    font-size: var(--matrix-font-size-sm);
}

.matrix-alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--matrix-success);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.matrix-alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: var(--matrix-warning);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.matrix-alert-error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--matrix-error);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-icon i {
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

/* ===== 页脚链接 ===== */
.matrix-login-footer {
    text-align: center;
    margin-top: var(--matrix-spacing-xl);
    padding-top: var(--matrix-spacing);
    border-top: 1px solid var(--matrix-gray-200);
}

.register-link,
.forgot-password {
    margin-bottom: var(--matrix-spacing-sm);
}

.register-link span,
.forgot-password a {
    font-size: var(--matrix-font-size-sm);
    color: var(--matrix-gray-500);
}

.register-link a,
.forgot-password a {
    color: var(--matrix-primary-color);
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover,
.forgot-password a:hover {
    text-decoration: underline;
}

/* ===== 语言选择器 ===== */
.matrix-language-selector {
    position: absolute;
    top: var(--matrix-spacing);
    right: var(--matrix-spacing);
    z-index: 10;
}

.language-dropdown {
    position: relative;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: var(--matrix-spacing-xs);
    padding: var(--matrix-spacing-sm) var(--matrix-spacing);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--matrix-gray-200);
    border-radius: var(--matrix-border-radius-sm);
    color: var(--matrix-gray-600);
    font-size: var(--matrix-font-size-sm);
    cursor: pointer;
    transition: var(--matrix-transition);
    backdrop-filter: blur(10px);
}

.language-toggle:hover {
    background: var(--matrix-white);
    border-color: var(--matrix-primary-color);
    color: var(--matrix-primary-color);
}

.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--matrix-spacing-xs);
    background: var(--matrix-white);
    border: 1px solid var(--matrix-gray-200);
    border-radius: var(--matrix-border-radius-sm);
    box-shadow: var(--matrix-shadow-lg);
    overflow: hidden;
    display: none;
    min-width: 120px;
}

.language-menu.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

.language-menu a {
    display: block;
    padding: var(--matrix-spacing-sm) var(--matrix-spacing);
    color: var(--matrix-gray-700);
    text-decoration: none;
    font-size: var(--matrix-font-size-sm);
    transition: var(--matrix-transition);
}

.language-menu a:hover {
    background: var(--matrix-gray-50);
    color: var(--matrix-primary-color);
}

/* ===== 背景装饰 ===== */
.matrix-background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.decoration-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.decoration-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    left: 10%;
    animation-delay: 2s;
}

.decoration-3 {
    width: 100px;
    height: 100px;
    top: 30%;
    left: 15%;
    animation-delay: 4s;
}

/* ===== 加载指示器 ===== */
.matrix-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    background: var(--matrix-white);
    padding: var(--matrix-spacing-2xl);
    border-radius: var(--matrix-border-radius-lg);
    text-align: center;
    box-shadow: var(--matrix-shadow-xl);
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 4px solid var(--matrix-gray-200);
    border-top: 4px solid var(--matrix-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--matrix-spacing) auto;
}

.loading-spinner p {
    margin: 0;
    font-size: var(--matrix-font-size-sm);
    color: var(--matrix-gray-600);
}

/* ===== 版权信息 ===== */
.matrix-footer {
    margin-top: var(--matrix-spacing-2xl);
    padding-top: var(--matrix-spacing);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.matrix-footer p {
    margin: 0;
    font-size: var(--matrix-font-size-xs);
    opacity: 0.8;
    color: var(--matrix-white);
}

/* ===== 动画定义 ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .matrix-brand-section {
        flex: 1;
        padding: var(--matrix-spacing-2xl);
    }

    .matrix-login-section {
        flex: 1;
        padding: var(--matrix-spacing-xl);
    }
}

@media (max-width: 768px) {
    .matrix-login-container {
        flex-direction: column;
    }

    .matrix-brand-section {
        flex: none;
        min-height: auto;
        padding: var(--matrix-spacing-xl) var(--matrix-spacing);
    }

    .matrix-features {
        display: none;
    }

    .matrix-title {
        font-size: var(--matrix-font-size-3xl);
    }

    .matrix-login-section {
        flex: 1;
        padding: var(--matrix-spacing);
    }

    .matrix-login-card {
        max-width: 100%;
    }

    .matrix-background-decoration {
        display: none;
    }

    .matrix-language-selector {
        position: static;
        text-align: center;
        margin-bottom: var(--matrix-spacing);
    }
}

@media (max-width: 480px) {
    .matrix-brand-content {
        text-align: center;
    }

    .matrix-logo img {
        width: 80px;
        height: 80px;
    }

    .matrix-title {
        font-size: var(--matrix-font-size-2xl);
    }

    .login-title {
        font-size: var(--matrix-font-size-2xl);
    }

    .form-control {
        padding: var(--matrix-spacing-lg) var(--matrix-spacing);
    }

    .matrix-btn {
        padding: var(--matrix-spacing-lg);
    }
}